#ifndef _I_PLUGIN_H
#define _I_PLUGIN_H
#include <string>
#include "INode.h"
#include "IBean.h"

#define  INTERFACES void BeanFactoryManager::init()
#define PLUGINS IPlugin* IPlugin::loadPlugin(const std::string &name)

class IPlugin : public IBean{
public:
    virtual ~IPlugin(){}
    virtual void onLoad(INode *node) {
    } 
    virtual void onUnload() {

    }
    virtual void onStart() {

    }
public:
    std::string pluginName;
    static IPlugin* loadPlugin(const std::string &name);
};
#define ADD_PLUGIN(CLASS)\
    if (name == #CLASS){\
        extern IPlugin *new##CLASS();\
        return new##CLASS();\
    }
#define REG_PLUGIN(CLASS) \
    IPlugin *new##CLASS()\
    {\
        return new CLASS();\
    }
#endif // _I_PLUGIN_H
